

function lunbo(oBut,aPosition,opa){
	//console.log(oBut);
	
	var aLi = oBut.getElementsByTagName('li');
	var aA = oBut.getElementsByTagName('a');
	var i = 0;
	var iNow = 0;
	var timer = null;
	var aSort = [];
	
	for(i=0;i<aLi.length;i++){
		aLi[i].index = i;
		aLi[i].style.width = aPosition[i].width +'px';
		aLi[i].style.height = aPosition[i].height +'px';
		aLi[i].style.top = aPosition[i].top +'px';
		aLi[i].style.left = aPosition[i].left +'px';
		aLi[i].style.zIndex = aPosition[i].zIndex;
		aSort[i] = aPosition[i];
		myAddEvent(aLi[i], 'mouseover', function(){
			var oDiv = this.getElementsByTagName('div')[0];
			startMove(oDiv, {opacity:0});
			clearInterval(timer);
		});
		myAddEvent(aLi[i], 'mouseout', function(){
			var oDiv = this.getElementsByTagName('div')[0];
			if(this.style.zIndex == "10"){
				startMove(oDiv, {opacity:0});
			}else{
				startMove(oDiv, {opacity:opa});
			}
			clearInterval(timer);
			timer = setInterval(setInter,2000);
		});
		myAddEvent(aLi[i], 'click', function(){
			var iSort = this.index;
			var oDiv = this.getElementsByTagName('div')[0];
			iNow = this.index;
			Sort();
			for(i=0;i<iSort;i++){
				aSort.unshift(aSort.pop());
			}
			sMove();
			startMove(oDiv,{opacity:0});
		});
	}
	myAddEvent(aA[0], 'click', function(){
		aSort.unshift(aSort.pop());
		sMove();
		setInter();
	});
	myAddEvent(aA[0], 'mouseover', function(){
			clearInterval(timer);
	});
	myAddEvent(aA[0], 'mouseout', function(){
			clearInterval(timer);
			timer = setInterval(setInter,2000);
	});
	myAddEvent(aA[1], 'click', function(){
		aSort.push(aSort.shift());
		sMove();
		iNow--;
		if(iNow<0)iNow = aLi.length - 1;
		
		/*var cLeft,rLeft;
		for(i=0;i<aLi.length;i++){
			var oDiv = aLi[i].getElementsByTagName('div')[0];
			if(aLi[i].style.zIndex == '10'){
				cLeft = aLi[i].style.left;
				console.log(cLeft);
			}
			if(aLi[i]){
				rLeft = aLi[i].style.left;
				if (parseInt(rLeft) > parseInt(cLeft)) {
					startMove(oDiv,{opacity:0});
				}
				console.log(rLeft);
			}
		}*/
	});
	myAddEvent(aA[1], 'mouseover', function(){
			clearInterval(timer);
	});
	myAddEvent(aA[1], 'mouseout', function(){
			clearInterval(timer);
			timer = setInterval(setInter,2000);
	});
	timer = setInterval(setInter,2000);
	function setInter(){
		iNow++;
		//if(iNow>aLi.length-1)iNow = 0;
		tab();
	}
	function tab(){
		var iSort = iNow;
		Sort();
		for(i=0;i<iSort;i++){
			aSort.unshift(aSort.pop());
		}
		sMove();
	}
	function Sort(){
		for(i=0;i<aLi.length;i++){
			aSort[i] = aPosition[i];
		}
	}
	function sMove(){
		for(i=0;i<aLi.length;i++){
			var oDiv = aLi[i].getElementsByTagName('div')[0];
			startMove(oDiv, {opacity:opa});
			startMove(aLi[i], aSort[i], function(){one();});
			aLi[i].className = '';
		}
	}
	function one(){
		for(i=0;i<aLi.length;i++){
			if(aLi[i].style.zIndex == '10'){
				var oDiv = aLi[i].getElementsByTagName('div')[0];
				startMove(oDiv, {opacity:0});
			}
		}
	}
	one();

	function getClass(oParent, sClass){
		var aElem = document.getElementsByTagName('*');
		var aClass = [];
		var i = 0;
		for(i=0;i<aElem.length;i++)if(aElem[i].className == sClass)aClass.push(aElem[i]);
		return aClass;
	}
	function myAddEvent(obj, sEvent, fn){
		if(!obj){
			
		}
		else{
			if(obj.attachEvent){
				obj.attachEvent('on' + sEvent, function(){
					fn.call(obj);
				});
			}else{
				obj.addEventListener(sEvent, fn, false);
			}
		}
	}
	function startMove(obj, json, fnEnd){
		if(obj.timer)clearInterval(obj.timer);
		obj.timer = setInterval(function (){
			doMove(obj, json, fnEnd);
		}, 30);
	}
	function getStyle(obj, attr){
		return obj.currentStyle ? obj.currentStyle[attr] : getComputedStyle(obj, false)[attr];
	}
	function doMove(obj, json, fnEnd){
		var iCur = 0;
		var attr = '';
		var bStop = true;
		for(attr in json){
			attr == 'opacity' ? iCur = parseInt(100*parseFloat(getStyle(obj, 'opacity'))) : iCur = parseInt(getStyle(obj, attr));
			if(isNaN(iCur))iCur = 0;
			if(navigator.userAgent.indexOf("MSIE 8.0") > 0){
				var iSpeed = (json[attr]-iCur) / 3;
			}else{
				var iSpeed = (json[attr]-iCur) / 5;
			}
			iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
			if(parseInt(json[attr])!=iCur)bStop = false;
			if(attr=='opacity'){
				obj.style.filter = "alpha(opacity:"+(iCur+iSpeed)+")";
				obj.style.opacity = (iCur + iSpeed) / 100;
			}else{
				attr == 'zIndex' ? obj.style[attr] = iCur + iSpeed : obj.style[attr] = iCur + iSpeed +'px';
			}
		}
		if(bStop){
			clearInterval(obj.timer);
			obj.timer = null;		
			if(fnEnd)fnEnd();
		}
	}
}

var all_reg_num = 213375;
var day_reg_num = 771;
var oBut3 = document.getElementById('list3');
var opaticy3 = 0;
var aPosition3 = [
    {width:622,height:346,top:-42,left:274,zIndex:10},
    {width:390,height:210,top:26,left:120,zIndex:8},
    {width:39,height:21,top:86,left:274,zIndex:6},
    {width:390,height:210,top:26,left:659,zIndex:8}
];
lunbo(oBut3,aPosition3,opaticy3);